home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
asm_msc1.arc
/
QPRINT.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-11-20
|
4KB
|
136 lines
page,132
title QPRINT - 8088 routine CALLed from BASIC
comment * by Dan Rollins Byte, July, 1983
This routine prints a string to the video display at
ten times the speed of BASIC. Works for color or
monochrome in 80 or 40 column TEXT modes (no graphics),
Characters are displayed with the existing color,
blink and underline attributes,
Called from BASIC via:
CALL QPRINT(VAR$,ROW%,CLM%)
Where:
CLM% is an integer variable name (1-80)
ROW% is an integer variable nmae (1-25)
VAR$ is a string variable name.
VAR$ is displayed beginning at position CLM% of line
ROW%. If too long, it will wrap around to the next line.
note: Color card pages 1-7 may be accessed by setting ROW%
above 25.
*
bios_data segment at 40H ;set up labels to determine
org 10H ;color or monochrome card
equip_flag label word
org 4AH ;40 or 80 column display
crt_clms label word
org 63H
addr_6845 label word ;points to video card ports
bios_data ends
cseg segment
assume CS:cseg, DS:nothing, ES:nothing
;
;Define the file header so that the Basic
;BLOAD file loader will know what to do,
; ------ these bytes are not executed ------
;
header:
db 0FDH ;indicated BLOAD file
dw 0 ;segment - BASIC will use default
dw 0 ;offset - secify in BLOAD command
dw rtn_len ;length of the routine
page
qprint proc far
push es ;must save for basic
mov bp,sp ;point to arguments on stack
mov bx,[bp+6] ;get addr of CLM% storage
mov di,[bx] ;get the column value
dec di ;adjust for LOCATE format
mov bx,[bp+8] ;get addr of ROW% storage
mov ax,[bx] ;get the screen line value
dec ax ;adjust for LOCATE format
mov bx,[bp+10] ;get ptr to string descriptor
xor ch,ch ;zero the high byte
mov cl,[bx] ;get length of string
cmp cl,0 ;null string?
je exit ;if so,do nothing, Else,
mov si,[bx+1] ;SI => 1st character of VAR$
;
mov bx,bios_data ;get ready to determine card type
mov es,bx ;and number of columns
mul es:crt_clms ;AX = CLM% * words per line
add di,ax ;DI = words from start of screen
shl di,1 ;adjust for attribute bytes
mov dx,es:addr_6845 ;point to 6845 base port
add dx,6 ;point to status port
;CX has the count of characters to write,
;SI points to the string data,
;DI points to a screen pointion
mov ax,0B800H ;default to color card
mov bx,es:equip_flag
and bx,30H
cmp bx,30H ;is it monochrome?
jne card_ok ;no, go
mov ax,0B000H ;yes, set for monochrome
card_ok:
mov es,ax ;points ES to video
;DS points to BASIC variables area
;ES points to video card memory
;Now display VAR$ on the screen.
call print_string
exit:
pop es ;restore segment register
ret 6 ;intersegment return,
;clearing stack of 3 args
qprint endp
page
;this procedure displays a string of characters
;expects:
; DS:SI => first character of string
; ES:DI => screen memory to display it
; CX => number of characters to display
; DX => status port of video card
print_string proc near
;-------- wait for horzontal retrace
test_low:
in al,dx ;get status
test al,1 ;is it low?
jnz test_low ;no, keep checking
cli ;turn off interrupts
test_hi:
in al,dx ;get status
test al,1 ;is it high?
jz test_hi ;no, keep checking
;-------- okay to write to screen now (no 'hash')
movsb ;[DS:DI]->[ES:DI],DI++,SI++,CX--
inc di ;skip the attribute byte
loop test_low ;do till end of string
sti ;turn interrupts back on
ret ;back to qprint proc
print_string endp
rtn_len equ $ -qprint ;define length for BLOAD header
cseg ends
end header ;needed for BIN file conversion